const express = require("express");
const app = express();
const router = require("./router/index.js");
const cors = require("cors");
const expressJwt = require("express-jwt")
app.use(cors());
app.use("/api",router);
app.use(function(err,req,res,next){
    res.send({
        status:"0",
        message:err.name
    })
})
app.use(express.urlencoded({extended:false}));
app.use(express.json())
app.use(expressJwt.expressjwt({
    secret:"-_-",
    algorithms:["HS256","RS256"]
}).unless({path:["/api"]}));
app.listen("777",()=>{
    console.log("端口开启成功")
});